extends Panel

signal comment_update

onready var num_input = get_node('vbox/hbox/num_input')
onready var textarea = get_node('vbox/textarea')

var has_update = false

func _ready():
	pass

func _notification(what):
	if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
		hide()

func set_cup_size(val):
	num_input.set_value(float(val))

func get_cup_size():
	return int(num_input.get_value())

func set_comment(txt):
	textarea.set_text(txt)

func get_comment():
	return textarea.get_text()

func on_update():
	if has_update:
		emit_signal('comment_update')
	hide()

func show():
	has_update = false
	get_tree().set_auto_accept_quit(false)
	.show()

func on_val_changed(arg):
	has_update = true
func on_text_changed():
	has_update = true
